let page = null

function checkLogin() {
  return new Promise((resolve, reject) => {
    const token = wx.getStorageSync('token')
    if (token) {
      resolve()
    } else {
      reject()
    }
  })
}

async function filter(that) {
  page = that
  page.setData({
    'isAuth': getApp().globalData.userInfo != null
  })
  return await checkLogin()
}

export default filter